@@ -233,7 +233,7 @@ def consumer_info_api(request): |
||
| 233 | 233 |
|
| 234 | 234 |
# 校验用户是否存在 |
| 235 | 235 |
try: |
| 236 |
- user = UserInfo.objects.get(user_id=user_id) |
|
| 236 |
+ user = UserInfo.objects.select_for_update().get(user_id=user_id) |
|
| 237 | 237 |
except UserInfo.DoesNotExist: |
| 238 | 238 |
return response(UserStatusCode.USER_NOT_FOUND) |
| 239 | 239 |
|
@@ -317,10 +317,7 @@ def consumer_info_api(request): |
||
| 317 | 317 |
continue |
| 318 | 318 |
|
| 319 | 319 |
# 更新销售员提交的表 |
| 320 |
- logs = SaleclerkSubmitLogInfo.objects.filter(code=serialNo, model_pk=model.pk, status=True) |
|
| 321 |
- for log in logs: |
|
| 322 |
- log.has_scan = True |
|
| 323 |
- log.save() |
|
| 320 |
+ SaleclerkSubmitLogInfo.objects.filter(code=serialNo, model_pk=model.pk, status=True).update(has_scan=True) |
|
| 324 | 321 |
|
| 325 | 322 |
ymd = tc.local_string(format='%Y%m%d') |
| 326 | 323 |
|
@@ -41,6 +41,7 @@ class Command(CompatibilityBaseCommand): |
||
| 41 | 41 |
user = UserInfo.objects.get(user_id=user_id) |
| 42 | 42 |
except UserInfo.DoesNotExist: |
| 43 | 43 |
continue |
| 44 |
+ |
|
| 44 | 45 |
if coupon_id: |
| 45 | 46 |
# 发放商城兑换券 |
| 46 | 47 |
try: |
@@ -90,7 +91,7 @@ class Command(CompatibilityBaseCommand): |
||
| 90 | 91 |
except CouponInfo.DoesNotExist: |
| 91 | 92 |
continue |
| 92 | 93 |
|
| 93 |
- for _ in xrange(right.coupon_num or coupon_num): |
|
| 94 |
+ for _ in range(right.coupon_num or coupon_num): |
|
| 94 | 95 |
UserCouponInfo.objects.create( |
| 95 | 96 |
brand_id=coupon.brand_id, |
| 96 | 97 |
brand_name=coupon.brand_name, |
@@ -14,7 +14,7 @@ def generate_uuid(): |
||
| 14 | 14 |
|
| 15 | 15 |
|
| 16 | 16 |
def generate_uuids(num=1000): |
| 17 |
- uuids = [generate_uuid() for i in xrange(num)] |
|
| 17 |
+ uuids = [generate_uuid() for i in range(num)] |
|
| 18 | 18 |
r.rpush(UUID_LIST, *uuids) |
| 19 | 19 |
|
| 20 | 20 |
|